/*************************************************************************
 * File Name:    B.cc
 * Author:       zero91
 * Mail:         jianzhang9102@gmail.com
 * Created Time: Sat 12 Oct 2013 09:30:51 AM CST
 * 
 * Description:  
 ************************************************************************/

#include <iostream>
#include <fstream>
#include <sstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>

using namespace std;

#define MAXB 1010

typedef long long llint;

bool cmp(const pair<int, llint> &a, const pair<int, llint> &b) { return a.second < b.second; }

inline llint
cost(int k, const vector<pair<llint, llint> > &person)
{
    llint ans = 0;

    for (size_t i = 0; i < person.size(); ++i) {
        ans += llabs(person[i].first - person[k].first) + llabs(person[i].second - person[k].second);
    }
    return ans;
}

int
main(int argc, char *argv[])
{
    std::ios_base::sync_with_stdio(false);

    llint T, B;
    llint x1, y1, x2, y2, mx, my;
    llint i, j, k;
    llint ansx, ansy, ansd;

    cin >> T;
    for (k = 1; k <= T; ++k) {
        vector<pair<llint , llint> > person;
        vector<llint> px, py;

        cin >> B;
        for (i = 0; i < B; ++i) {
            cin >> x1 >> y1 >> x2 >> y2;
            for (llint s = x1; s <= x2; ++s) {
                for (llint t = y1; t <= y2; ++t) {
                    person.push_back(make_pair(s,t));
                    px.push_back(s);
                    py.push_back(t);
                }
            }
        }
        sort(px.begin(), px.end());
        sort(py.begin(), py.end());
        mx = px[px.size() / 2];
        my = py[py.size() / 2];

        vector<pair<int, llint> > ans_pid;
        for (size_t s = 0; s < person.size(); ++s) {
            ans_pid.push_back(make_pair(s, llabs(mx - person[s].first) + llabs(my - person[s].second)));
        }
        sort(ans_pid.begin(), ans_pid.end(), cmp);
    
        ansd = -1;
        int limit = 100 > ans_pid.size() ? ans_pid.size() : 100;
        llint tmp;
        for (int i = 0; i < limit; ++i) {
            tmp = cost(ans_pid[i].first, person);
            if (ansd == -1) ansd = tmp;
            if (tmp < ansd) {
                ansx = person[ans_pid[i].first].first;
                ansy = person[ans_pid[i].first].second;
                ansd = tmp;
            }
            if (tmp == ansd && ansx > ans_pid[i].first) {
                ansx = person[ans_pid[i].first].first;
                ansy = person[ans_pid[i].first].second;
            }
        }
        cout << "Case #" << k << ": " << ansx << " " << ansy << " " << ansd << endl;
    }
    return 0;
}
